<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%
	String contextRoot = request.getContextPath();
%>
<f:loadBundle basename="properties.messages" var="msg"/>
<f:view>
<!doctype html>

<head>
	<%@ include file="include/meta.jsp" %>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- Mimic Internet Explorer 7 -->
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7,chrome=1">
	
	<title>SISDEP : Sistema de Informaci<h:outputText value="#{msg.tilde_o}" />n de Espacio P<h:outputText value="#{msg.tilde_u}" />blico</title>
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="stylesheet" href="<%=contextRoot%>/css/validationEngine.jquery.css" type="text/css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/template.css" type="text/css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/normalize.css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/uniform.css"> <!-- estilos formularios -->
	<link rel="stylesheet" href="<%=contextRoot%>/css/cuerpo.css">	
	<link rel="stylesheet" href="<%=contextRoot%>/css/richCustom.css">
</head>
<body>
<div id="marco"> <!--inicio contenedor --> 
<div class="arriba-cuerpo"></div> <!-- Para ver borde redondo en IE -->
<div class="cuerpo">
<a href="<%=contextRoot%>/index.jsf"><img src="<%= contextRoot %>/images/logos.png" /></a>
<div class="clear"></div>
<!-- Menu y Usuario init() -->
	<%@ include file="include/menuUsuario.jsp" %>
<!-- Menu y Usuario end() -->
<div class="clear"></div>
<!-- Formulario --> 
<div id="buscador">
<h2>Regulaci<h:outputText value="#{msg.tilde_o}" />n – Reportes Comerciante</h2>

<h:form id="regulationReportsForm">
<span class="left" style="margin-left:0px">
<label>Tipo de Comerciante<span class="asterisco"> * </span></label>
	<h:selectOneMenu id="reportType" styleClass="validate[required]" 
					value="#{reporteRegulacionController.reportType}">

        <f:selectItem itemLabel="Seleccione..." itemValue=""/>
        <f:selectItems value="#{reporteRegulacionController.sellerReportTypeList}"/>
    </h:selectOneMenu>	
</span>
<span class="left" style="margin-left:30px">
<label>Fecha Inicial<span class="asterisco"> * </span></label>
 	<h:inputText id="initialDate" styleClass="validate[required, custom[date]] initialDate" size="10" maxlength="10"
			value="#{reporteRegulacionController.initDate}">
	</h:inputText>
</span>
<span class="left" style="margin-left:30px">
<label>Fecha Final<span class="asterisco"> * </span></label>
	<h:inputText id="endDate" styleClass="validate[required, custom[date]] endDate" size="10" maxlength="10"
			value="#{reporteRegulacionController.endDate}">
	</h:inputText>
</span>

<br/>
<div class="clear">(<span class="asterisco"> * </span>) : Campo Obligatorio.</div>
<div class="clear"></div>

<span class="botones right">
	<h:commandButton id="regReportGenerateButton"
				 type="submit" 
                 value="Generar Reporte" 
                 ondblclick="return false;" 
                 styleClass="buscador form button"
                 onclick="exportToPDF();" >
	</h:commandButton>
</span>
</h:form>
</div>
<!-- Fin formulario -->
<!-- Fin tabla -->
</div>
<div class="abajo-cuerpo"></div> <!-- Para ver borde redondo en IE -->
</div> <!-- Fin contenedor -->
<div class="footer"></div>

	<script src="<%=contextRoot%>/js/jquery/lib/jquery-1.7.2.min.js"></script><!-- De ser 1ro -->
	<script src="<%=contextRoot%>/js/script.js" type="text/javascript"></script><!-- De ser 2do -->
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.uniform.min.js"></script> <!-- formularios --> 
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=contextRoot%>/js/jquery.maskedinput-1.3.js" type="text/javascript"></script>
	
	<script src="<%=contextRoot%>/js/sisdep.js"	type="text/javascript"></script>
	
	<script type="text/javascript">
	jQ(document).ready(function() {
		jQ("input, select, input:checkbox, input:radio, input:file").uniform();
		jQ("#regulationReportsForm").validationEngine('attach');
		jQ("#regulationReportsForm").bind("jqv.form.result", function(event, errorFound) {
	        if(!errorFound) displayLoadingImage();
	    });
		
		jQ(".initialDate").mask("99/99/9999");
		jQ(".endDate").mask("99/99/9999");
	});
	
	function exportToPDF() { 
		var reportNameTemp = 'reporteCiante' + document.getElementById('regulationReportsForm:reportType').value + 'PDF';
		showReportPopup('<%= contextRoot %>/reportController.view?format=pdf&reportName=' + reportNameTemp);
    }
	
	/**
	 * Funcion JS que permite invocar el servlet de generacion de reportes y presentar una ventana independiente
	 * para su descarga.
	 * 
	 * @author carlos.perez@consult-soft.com
	 * @param servletReporterURL
	 */
	function showReportPopup(servletReporterURL){
	    window.open(servletReporterURL, "reportStandardPopup",
	                "toolbar=0,location=0,scrollbars=1,directories=0,status=0,menubar=0,resizable=1,width="+550+",height="+550+",left="+(screen.width-550)/2+",top="+(screen.height-550)/2);
	}
	</script>
	
	<%@ include file="include/validationStatus.jsp" %>
	<%@ include file="include/modalMessageWindow.jsp" %>
	
</body>
</html>
</f:view>